package cn.iocoder.yudao.module.pplan.dal.mysql.twcleaningplan;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.pplan.controller.admin.twcleaningplan.vo.TwCleaningPlanPageReqVO;
import cn.iocoder.yudao.module.pplan.dal.dataobject.twcleaningplan.TwCleaningPlanDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 生产计划-餐具清洗计划 Mapper
 *
 * @author yisla
 */
@Mapper
public interface TwCleaningPlanMapper extends BaseMapperX<TwCleaningPlanDO> {

    default PageResult<TwCleaningPlanDO> selectPage(TwCleaningPlanPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<TwCleaningPlanDO>()
                .likeIfPresent(TwCleaningPlanDO::getCplanCode, reqVO.getCplanCode())
                .likeIfPresent(TwCleaningPlanDO::getFlightNo, reqVO.getFlightNo())
                .eqIfPresent(TwCleaningPlanDO::getCleaningStatus, reqVO.getCleaningStatus())
                .geIfPresent(TwCleaningPlanDO::getStartDate, reqVO.getStartDate())
                .leIfPresent(TwCleaningPlanDO::getEndDate, reqVO.getEndDate())
                .orderByDesc(TwCleaningPlanDO::getId));
    }

}